feat(worktree-isolation): refresh the wtg reference to the current engine#137
Open
KailasMahavarkar wants to merge 1 commit into
Open
feat(worktree-isolation): refresh the wtg reference to the current engine#137KailasMahavarkar wants to merge 1 commit into
KailasMahavarkar wants to merge 1 commit into
Conversation
…gine The reference implementation had drifted well behind the working tool. Brings across the engine improvements, keeping the same shape: a CONFIG block of pure data and a stack-agnostic engine that hardcodes no role, port, or path. New surface: - deps: declare a dep dir per role (node_modules, .venv) and the command that builds it. A worktree is only a checkout, so without this a fresh member starts and immediately dies. new/add now seed config and build deps, leaving a runnable tree; --no-env/--no-deps opt out. - bind: creating a group from the current tree is now explicit. A bare `wtg <name>` binds only into an existing group, so a typo such as `wtg downfoo` can no longer create a group, rebind the tree away from its real one, and overwrite its dev.sh. - --base <ref>: per-run start point. Repos are fetched first and a bare name resolves to origin/<name>, so a worktree is cut from the latest remote tip rather than a stale local branch. - st: one table carrying branch, clean/DIRTY, upstream, commits behind base, port, config and dep state, followed by a warnings block that prints the exact command to fix each problem. --fetch refreshes first. - up/down: members launch in their own process group and down kills the group. Killing only the recorded pid left the pnpm->vite and uvicorn-reloader children alive holding the ports, so every later up died with EADDRINUSE while orphans kept serving stale code. - WTG_WORKDIR, WTG_LAUNCHER_ARGS, WTG_OAUTH_ROLES, and WTG_API_ROLE split from WTG_PRIMARY_ROLE, since the backend a frontend calls is not always the tree the agent opens in nor the one holding the OAuth redirect. Seeded config is written with install -m 600 rather than cp. These files carry live secrets and cp takes the caller's umask, which on a common 0002 leaves them world-readable at 0644. Defaults stay tool-agnostic: XDG paths, a generic api/web example, and no launcher arguments. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
references/wtg.reference.shis the adoption artifact for the Multi-Repo Feature Groups pattern, but it had drifted well behind the tool it documents. Adopters copying it got a version missing the things that make the pattern actually survive daily use, and one that leaves seeded secrets world-readable.What a member needs to be runnable
flowchart TB A[git worktree add] --> B[tracked files only] B --> C{runnable?} C -->|no| D[gitignored config absent<br/>service boots mis-configured] C -->|no| E[dep dir absent<br/>node_modules / .venv] D --> F[seed config -- install -m 600] E --> G[build deps from WTG_SETUP] F --> H[runnable member] G --> HNote
git worktree addchecks out tracked files only. Config and dependencies are both invisible to it, so creation has to supply both or the failure is just deferred to first run.Why these changes
bind--base <ref>, bare name ->origin/<name>sttable + warnings blockdowninstall -m 600when seedingWarning
Killing only the recorded pid left the
pnpm->viteand uvicorn-reloader children alive holding the ports. Every laterupthen failed withEADDRINUSEwhile the orphans kept serving stale code. Members now launch in their own process group anddownkills the group.What changed
references/wtg.reference.sh- engine refresh; newdepsandbindverbs,--base/--no-env/--no-deps,st --fetch,help, richerstrenderer, process-groupup/down, andWTG_WORKDIR/WTG_DEPS/WTG_SETUP/WTG_LAUNCHER_ARGS/WTG_OAUTH_ROLESconfig knobs.WTG_API_ROLEsplits fromWTG_PRIMARY_ROLE, since the backend a frontend calls is not always the tree the agent opens in nor the one holding the OAuth redirect (%PRIMARY_PORT%->%API_PORT%).references/SETUP.md- config block, placeholder table, quickstart and command reference brought in line.references/multi-repo-feature-groups.md-depsverb, the dependencies-are-not-carried gap, and the seeding-mode requirement.SKILL.md- two quick-reference rows and the matching runtime-hazard bullets.Defaults stay tool-agnostic: XDG paths, a generic
api/webexample, and no launcher arguments.Verifying
bash -nclean. Exercised end to end against throwaway repos with realoriginremotes:Important
bun run buildwas not run -tscis absent in a fresh clone withoutbun install. This change touches only.shand.md, no TypeScript.